package Fangfalianxi;

import java.util.Random;

//抽奖
//直播抽奖，奖金是现金红包，分别有{2，588，888，1000，10000}五个奖金。请使用代码模拟抽奖，打印出每个奖项，奖项的出现顺序要随机且
//不重复。
/*public class test8 {
    public static void main(String[] args) {
        int[] arr = {2,588,888,1000,10000};
        int[] newArr = new int[arr.length];
        Random r = new Random();
        for (int i = 0; i < 5; ) {
            int RandomIndex = r.nextInt(arr.length);
            int prize = arr[RandomIndex];
           boolean flag = contains(newArr,prize);
           if(!flag){
               newArr[i] = prize;
               i++;
           }
        }
        for (int i = 0; i < newArr.length; i++) {
            System.out.println(newArr[i]);
        }
    }

    public static boolean contains(int[] arr,int prize){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == prize){
                return true;
            }
        }
        return false;
    }
}*/

public class test8 {
    public static void main(String[] args) {
        int[] arr = {2,588,888,1000,10000};
        Random r = new Random();
        for (int i = 0; i < arr.length; i++) {
            int randomIndex = r.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[randomIndex];
            arr[i] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}